package com.dd.stack.postgresql.config;

import com.alibaba.druid.pool.DruidDataSource;
import com.dd.stack.postgresql.annotation.ATTENTION;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @Author liuxianmeng
 * @CreateTime 2025/2/11 20:27
 * @Description 数据源配置
 */
@Configuration
public class DataSourceConfig {

    @Bean
    @ATTENTION("postgreSQL默认的超级用户是postgres")
    public DataSource dataSource() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:postgresql://localhost:5432/postgres?serverTimezone=UTC");
        dataSource.setUsername("postgres");
        dataSource.setPassword("123456");
        dataSource.setDriverClassName("org.postgresql.Driver");
        return dataSource;
    }
}